/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    'ap-northeast-1' = 'agency.aliyuncs.com',
    'ap-northeast-2-pop' = 'agency.aliyuncs.com',
    'ap-south-1' = 'agency.aliyuncs.com',
    'ap-southeast-2' = 'agency.aliyuncs.com',
    'ap-southeast-3' = 'agency.aliyuncs.com',
    'ap-southeast-5' = 'agency.aliyuncs.com',
    'cn-beijing' = 'agency.aliyuncs.com',
    'cn-beijing-finance-1' = 'agency.aliyuncs.com',
    'cn-beijing-finance-pop' = 'agency.aliyuncs.com',
    'cn-beijing-gov-1' = 'agency.aliyuncs.com',
    'cn-beijing-nu16-b01' = 'agency.aliyuncs.com',
    'cn-chengdu' = 'agency.aliyuncs.com',
    'cn-edge-1' = 'agency.aliyuncs.com',
    'cn-fujian' = 'agency.aliyuncs.com',
    'cn-haidian-cm12-c01' = 'agency.aliyuncs.com',
    'cn-hangzhou' = 'agency.aliyuncs.com',
    'cn-hangzhou-bj-b01' = 'agency.aliyuncs.com',
    'cn-hangzhou-finance' = 'agency.aliyuncs.com',
    'cn-hangzhou-internal-prod-1' = 'agency.aliyuncs.com',
    'cn-hangzhou-internal-test-1' = 'agency.aliyuncs.com',
    'cn-hangzhou-internal-test-2' = 'agency.aliyuncs.com',
    'cn-hangzhou-internal-test-3' = 'agency.aliyuncs.com',
    'cn-hangzhou-test-306' = 'agency.aliyuncs.com',
    'cn-hongkong' = 'agency.aliyuncs.com',
    'cn-hongkong-finance-pop' = 'agency.aliyuncs.com',
    'cn-huhehaote' = 'agency.aliyuncs.com',
    'cn-huhehaote-nebula-1' = 'agency.aliyuncs.com',
    'cn-north-2-gov-1' = 'agency.aliyuncs.com',
    'cn-qingdao' = 'agency.aliyuncs.com',
    'cn-qingdao-nebula' = 'agency.aliyuncs.com',
    'cn-shanghai' = 'agency.aliyuncs.com',
    'cn-shanghai-et15-b01' = 'agency.aliyuncs.com',
    'cn-shanghai-et2-b01' = 'agency.aliyuncs.com',
    'cn-shanghai-finance-1' = 'agency.aliyuncs.com',
    'cn-shanghai-inner' = 'agency.aliyuncs.com',
    'cn-shanghai-internal-test-1' = 'agency.aliyuncs.com',
    'cn-shenzhen' = 'agency.aliyuncs.com',
    'cn-shenzhen-finance-1' = 'agency.aliyuncs.com',
    'cn-shenzhen-inner' = 'agency.aliyuncs.com',
    'cn-shenzhen-st4-d01' = 'agency.aliyuncs.com',
    'cn-shenzhen-su18-b01' = 'agency.aliyuncs.com',
    'cn-wuhan' = 'agency.aliyuncs.com',
    'cn-wulanchabu' = 'agency.aliyuncs.com',
    'cn-yushanfang' = 'agency.aliyuncs.com',
    'cn-zhangbei' = 'agency.aliyuncs.com',
    'cn-zhangbei-na61-b01' = 'agency.aliyuncs.com',
    'cn-zhangjiakou' = 'agency.aliyuncs.com',
    'cn-zhangjiakou-na62-a01' = 'agency.aliyuncs.com',
    'cn-zhengzhou-nebula-1' = 'agency.aliyuncs.com',
    'eu-central-1' = 'agency.aliyuncs.com',
    'eu-west-1' = 'agency.aliyuncs.com',
    'eu-west-1-oxs' = 'agency.aliyuncs.com',
    'me-east-1' = 'agency.aliyuncs.com',
    'rus-west-1-pop' = 'agency.aliyuncs.com',
    'us-east-1' = 'agency.aliyuncs.com',
    'us-west-1' = 'agency.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('agency', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model GetBillDetailFileListRequest {
  billMonth?: string(name='BillMonth', description='This parameter is required.', example='202502'),
  ossAccessKeyId?: string(name='OssAccessKeyId'),
  ossAccessKeySecret?: string(name='OssAccessKeySecret'),
  ossBucketName?: string(name='OssBucketName'),
  ossEndpoint?: string(name='OssEndpoint'),
  ossRegion?: string(name='OssRegion'),
  ossSecurityToken?: string(name='OssSecurityToken'),
}

model GetBillDetailFileListResponseBody = {
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      billMonth?: string(name='BillMonth', example='202502'),
      fileName?: string(name='FileName'),
      fileUrl?: string(name='FileUrl', example='aps.ailyun.com/file/download?resourceId=1234&type=1'),
      status?: string(name='Status'),
      type?: string(name='Type'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  msg?: string(name='Msg'),
  requestId?: string(name='RequestId', description='Id of the request', example='210bc4b416874189683843905d9f9a'),
  success?: boolean(name='Success', example='true'),
}

model GetBillDetailFileListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetBillDetailFileListResponseBody(name='body'),
}

/**
 * @summary 查询账单导出文件
 *
 * @param request GetBillDetailFileListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetBillDetailFileListResponse
 */
async function getBillDetailFileListWithOptions(request: GetBillDetailFileListRequest, runtime: Util.RuntimeOptions): GetBillDetailFileListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.billMonth)) {
    query['BillMonth'] = request.billMonth;
  }
  if (!Util.isUnset(request.ossAccessKeyId)) {
    query['OssAccessKeyId'] = request.ossAccessKeyId;
  }
  if (!Util.isUnset(request.ossAccessKeySecret)) {
    query['OssAccessKeySecret'] = request.ossAccessKeySecret;
  }
  if (!Util.isUnset(request.ossBucketName)) {
    query['OssBucketName'] = request.ossBucketName;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  if (!Util.isUnset(request.ossRegion)) {
    query['OssRegion'] = request.ossRegion;
  }
  if (!Util.isUnset(request.ossSecurityToken)) {
    query['OssSecurityToken'] = request.ossSecurityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetBillDetailFileList',
    version = '2025-02-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询账单导出文件
 *
 * @param request GetBillDetailFileListRequest
 * @return GetBillDetailFileListResponse
 */
async function getBillDetailFileList(request: GetBillDetailFileListRequest): GetBillDetailFileListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getBillDetailFileListWithOptions(request, runtime);
}

model GetCommissionDetailFileListRequest {
  billMonth?: string(name='BillMonth', example='202501'),
  ossAccessKeyId?: string(name='OssAccessKeyId'),
  ossAccessKeySecret?: string(name='OssAccessKeySecret'),
  ossBucketName?: string(name='OssBucketName'),
  ossEndpoint?: string(name='OssEndpoint'),
  ossRegion?: string(name='OssRegion'),
  ossSecurityToken?: string(name='OssSecurityToken'),
}

model GetCommissionDetailFileListResponseBody = {
  code?: string(name='Code', description='code', example='200'),
  data?: {
    billMonth?: string(name='BillMonth', example='202502'),
    fileList?: [ 
      {
        bucketSyncStatus?: string(name='BucketSyncStatus'),
        commissionPolicyName?: string(name='CommissionPolicyName'),
        fileName?: string(name='FileName'),
        fileType?: string(name='FileType'),
        fileUrl?: string(name='FileUrl', example='aps.ailyun.com/file/download?resourceId=1234&type=1'),
      }
    ](name='FileList'),
    partnerUid?: string(name='PartnerUid', example='1112332432'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request', example='9C14ADFE-DF0A-54D4-8BD5-45D0839246B4'),
  success?: boolean(name='Success', example='true'),
}

model GetCommissionDetailFileListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCommissionDetailFileListResponseBody(name='body'),
}

/**
 * @summary 查询伙伴佣金明细
 *
 * @param request GetCommissionDetailFileListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetCommissionDetailFileListResponse
 */
async function getCommissionDetailFileListWithOptions(request: GetCommissionDetailFileListRequest, runtime: Util.RuntimeOptions): GetCommissionDetailFileListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.billMonth)) {
    query['BillMonth'] = request.billMonth;
  }
  if (!Util.isUnset(request.ossAccessKeyId)) {
    query['OssAccessKeyId'] = request.ossAccessKeyId;
  }
  if (!Util.isUnset(request.ossAccessKeySecret)) {
    query['OssAccessKeySecret'] = request.ossAccessKeySecret;
  }
  if (!Util.isUnset(request.ossBucketName)) {
    query['OssBucketName'] = request.ossBucketName;
  }
  if (!Util.isUnset(request.ossEndpoint)) {
    query['OssEndpoint'] = request.ossEndpoint;
  }
  if (!Util.isUnset(request.ossRegion)) {
    query['OssRegion'] = request.ossRegion;
  }
  if (!Util.isUnset(request.ossSecurityToken)) {
    query['OssSecurityToken'] = request.ossSecurityToken;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCommissionDetailFileList',
    version = '2025-02-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询伙伴佣金明细
 *
 * @param request GetCommissionDetailFileListRequest
 * @return GetCommissionDetailFileListResponse
 */
async function getCommissionDetailFileList(request: GetCommissionDetailFileListRequest): GetCommissionDetailFileListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCommissionDetailFileListWithOptions(request, runtime);
}

model GetCustomerOrderListRequest {
  customerAccount?: string(name='CustomerAccount', example='test_123'),
  customerUid?: long(name='CustomerUid', example='123456'),
  orderCreateAfter?: long(name='OrderCreateAfter', example='1727789348000'),
  orderCreateBefore?: long(name='OrderCreateBefore', example='1741008566000'),
  orderId?: long(name='OrderId', example='13595216'),
  orderPayAfter?: long(name='OrderPayAfter', example='1727789348000'),
  orderPayBefore?: long(name='OrderPayBefore', example='1741008566000'),
  orderStatus?: int32(name='OrderStatus', example='3'),
  orderTypeList?: [ string ](name='OrderTypeList'),
  pageNo?: int32(name='PageNo', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='10'),
  payAmountAfter?: double(name='PayAmountAfter', example='1'),
  payAmountBefore?: double(name='PayAmountBefore', example='1000'),
  payType?: int32(name='PayType', example='1'),
  productCode?: string(name='ProductCode', example='ecs'),
  productName?: string(name='ProductName'),
  projectId?: long(name='ProjectId', example='202502002231'),
  ramAccountForCustomerManager?: string(name='RamAccountForCustomerManager', example='1234532'),
}

model GetCustomerOrderListShrinkRequest {
  customerAccount?: string(name='CustomerAccount', example='test_123'),
  customerUid?: long(name='CustomerUid', example='123456'),
  orderCreateAfter?: long(name='OrderCreateAfter', example='1727789348000'),
  orderCreateBefore?: long(name='OrderCreateBefore', example='1741008566000'),
  orderId?: long(name='OrderId', example='13595216'),
  orderPayAfter?: long(name='OrderPayAfter', example='1727789348000'),
  orderPayBefore?: long(name='OrderPayBefore', example='1741008566000'),
  orderStatus?: int32(name='OrderStatus', example='3'),
  orderTypeListShrink?: string(name='OrderTypeList'),
  pageNo?: int32(name='PageNo', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='10'),
  payAmountAfter?: double(name='PayAmountAfter', example='1'),
  payAmountBefore?: double(name='PayAmountBefore', example='1000'),
  payType?: int32(name='PayType', example='1'),
  productCode?: string(name='ProductCode', example='ecs'),
  productName?: string(name='ProductName'),
  projectId?: long(name='ProjectId', example='202502002231'),
  ramAccountForCustomerManager?: string(name='RamAccountForCustomerManager', example='1234532'),
}

model GetCustomerOrderListResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', example='None'),
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      amountDiscount?: double(name='AmountDiscount', example='1'),
      amountDue?: double(name='AmountDue', example='29137'),
      createdAt?: string(name='CreatedAt', example='2019-01-24 14:20:40'),
      customerAccount?: string(name='CustomerAccount', example='test_123'),
      customerClassification?: string(name='CustomerClassification'),
      customerUid?: long(name='CustomerUid', example='123456'),
      deductedAmountByCoupons?: double(name='DeductedAmountByCoupons', example='0'),
      discountedPrice?: double(name='DiscountedPrice', example='29137'),
      orderId?: long(name='OrderId', example='236414227150922'),
      orderStatus?: int32(name='OrderStatus', example='3'),
      orderType?: string(name='OrderType', example='BUY'),
      paidAt?: string(name='PaidAt', example='2019-01-24 14:20:40'),
      payType?: int32(name='PayType', example='1'),
      price?: double(name='Price', example='29137'),
      productCode?: string(name='ProductCode', example='slb'),
      productName?: string(name='ProductName', example='slb'),
      projectId?: long(name='ProjectId', example='202502230421'),
      ramAccountForCustomerManagers?: [ string ](name='RamAccountForCustomerManagers'),
    }
  ](name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode', example='400'),
  message?: string(name='Message', example='success'),
  pageNo?: int32(name='PageNo', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', example='2103a30617045934095083027d88c5'),
  success?: boolean(name='Success', example='true'),
  total?: int32(name='Total', example='100'),
}

model GetCustomerOrderListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCustomerOrderListResponseBody(name='body'),
}

/**
 * @summary 查询伙伴拓客订单
 *
 * @param tmpReq GetCustomerOrderListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetCustomerOrderListResponse
 */
async function getCustomerOrderListWithOptions(tmpReq: GetCustomerOrderListRequest, runtime: Util.RuntimeOptions): GetCustomerOrderListResponse {
  Util.validateModel(tmpReq);
  var request = new GetCustomerOrderListShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.orderTypeList)) {
    request.orderTypeListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.orderTypeList, 'OrderTypeList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.customerAccount)) {
    query['CustomerAccount'] = request.customerAccount;
  }
  if (!Util.isUnset(request.customerUid)) {
    query['CustomerUid'] = request.customerUid;
  }
  if (!Util.isUnset(request.orderCreateAfter)) {
    query['OrderCreateAfter'] = request.orderCreateAfter;
  }
  if (!Util.isUnset(request.orderCreateBefore)) {
    query['OrderCreateBefore'] = request.orderCreateBefore;
  }
  if (!Util.isUnset(request.orderId)) {
    query['OrderId'] = request.orderId;
  }
  if (!Util.isUnset(request.orderPayAfter)) {
    query['OrderPayAfter'] = request.orderPayAfter;
  }
  if (!Util.isUnset(request.orderPayBefore)) {
    query['OrderPayBefore'] = request.orderPayBefore;
  }
  if (!Util.isUnset(request.orderStatus)) {
    query['OrderStatus'] = request.orderStatus;
  }
  if (!Util.isUnset(request.orderTypeListShrink)) {
    query['OrderTypeList'] = request.orderTypeListShrink;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.payAmountAfter)) {
    query['PayAmountAfter'] = request.payAmountAfter;
  }
  if (!Util.isUnset(request.payAmountBefore)) {
    query['PayAmountBefore'] = request.payAmountBefore;
  }
  if (!Util.isUnset(request.payType)) {
    query['PayType'] = request.payType;
  }
  if (!Util.isUnset(request.productCode)) {
    query['ProductCode'] = request.productCode;
  }
  if (!Util.isUnset(request.productName)) {
    query['ProductName'] = request.productName;
  }
  if (!Util.isUnset(request.projectId)) {
    query['ProjectId'] = request.projectId;
  }
  if (!Util.isUnset(request.ramAccountForCustomerManager)) {
    query['RamAccountForCustomerManager'] = request.ramAccountForCustomerManager;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCustomerOrderList',
    version = '2025-02-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询伙伴拓客订单
 *
 * @param request GetCustomerOrderListRequest
 * @return GetCustomerOrderListResponse
 */
async function getCustomerOrderList(request: GetCustomerOrderListRequest): GetCustomerOrderListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCustomerOrderListWithOptions(request, runtime);
}

model GetRenewalRateListRequest {
  fiscalYearAndQuarter?: string(name='FiscalYearAndQuarter', description='This parameter is required.', example='2025Q4'),
}

model GetRenewalRateListResponseBody = {
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      customerAdjustedRenewalAmountDue?: double(name='CustomerAdjustedRenewalAmountDue', example='100'),
      customerOtherBillAmount?: double(name='CustomerOtherBillAmount', example='100'),
      finalCustomerRenewalAmountDue?: double(name='FinalCustomerRenewalAmountDue', example='100'),
      finalCustomerRenewalRate?: double(name='FinalCustomerRenewalRate', example='0.9'),
      finalCustomerRenewedAmount?: double(name='FinalCustomerRenewedAmount', example='100'),
      finalOtherBillAmount?: double(name='FinalOtherBillAmount', example='100'),
      finalRenewalAmountDue?: double(name='FinalRenewalAmountDue', example='100'),
      finalRenewalRate?: double(name='FinalRenewalRate', example='0.9'),
      finalRenewedAmount?: double(name='FinalRenewedAmount', example='100'),
      finalSubPartnerRenewalAmountDue?: double(name='FinalSubPartnerRenewalAmountDue', example='100'),
      finalSubPartnerRenewalRate?: double(name='FinalSubPartnerRenewalRate', example='0.85'),
      finalSubPartnerRenewedAmount?: double(name='FinalSubPartnerRenewedAmount', example='100'),
      fiscalYearAndQuarter?: string(name='FiscalYearAndQuarter', example='2025Q4'),
      masterPid?: string(name='MasterPid', example='P123423453'),
      masterPidName?: string(name='MasterPidName'),
      specialCustomerRenewRatio?: double(name='SpecialCustomerRenewRatio', example='0.7'),
      specialCustomerRenewalAmountDue?: double(name='SpecialCustomerRenewalAmountDue', example='100'),
      specialCustomerRenewedAmount?: double(name='SpecialCustomerRenewedAmount', example='100'),
      specialFinalRenewRatio?: double(name='SpecialFinalRenewRatio', example='0.7'),
      specialFinalRenewalAmountDue?: double(name='SpecialFinalRenewalAmountDue', example='100'),
      specialFinalRenewedAmount?: double(name='SpecialFinalRenewedAmount', example='100'),
      specialSubPartnerRenewRatio?: double(name='SpecialSubPartnerRenewRatio', example='0.8'),
      specialSubPartnerRenewalAmountDue?: double(name='SpecialSubPartnerRenewalAmountDue', example='100'),
      specialSubPartnerRenewedAmount?: double(name='SpecialSubPartnerRenewedAmount', example='100'),
      subPartnerAdjustedRenewalAmountDue?: double(name='SubPartnerAdjustedRenewalAmountDue', example='100'),
      subPartnerOtherBillAmount?: double(name='SubPartnerOtherBillAmount', example='100'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request', example='9C14ADFE-DF0A-54D4-8BD5-45D0839246B4'),
  success?: boolean(name='Success', example='true'),
}

model GetRenewalRateListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetRenewalRateListResponseBody(name='body'),
}

/**
 * @summary 查询伙伴续费率
 *
 * @param request GetRenewalRateListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetRenewalRateListResponse
 */
async function getRenewalRateListWithOptions(request: GetRenewalRateListRequest, runtime: Util.RuntimeOptions): GetRenewalRateListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.fiscalYearAndQuarter)) {
    query['FiscalYearAndQuarter'] = request.fiscalYearAndQuarter;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRenewalRateList',
    version = '2025-02-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询伙伴续费率
 *
 * @param request GetRenewalRateListRequest
 * @return GetRenewalRateListResponse
 */
async function getRenewalRateList(request: GetRenewalRateListRequest): GetRenewalRateListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getRenewalRateListWithOptions(request, runtime);
}

model GetSubPartnerListRequest {
  pageNo?: int32(name='PageNo', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='10'),
  subPartnerCompanyName?: string(name='SubPartnerCompanyName'),
  subPartnerPid?: string(name='SubPartnerPid', example='2323431211'),
}

model GetSubPartnerListResponseBody = {
  message?: string(name='Message'),
  pageNo?: string(name='PageNo', example='1'),
  pageSize?: string(name='PageSize', description='This parameter is required.', example='100'),
  requestId?: string(name='RequestId', example='9C14ADFE-DF0A-54D4-8BD5-45D0839246B4'),
  subPartnerList?: [ 
    {
      address?: string(name='Address'),
      agreementStatus?: string(name='AgreementStatus'),
      agreementStatusDesc?: string(name='AgreementStatusDesc'),
      city?: string(name='City'),
      companyName?: string(name='CompanyName'),
      contact?: string(name='Contact'),
      district?: string(name='District'),
      joinTime?: string(name='JoinTime'),
      masterAccount?: string(name='MasterAccount'),
      masterUid?: string(name='MasterUid'),
      pid?: string(name='Pid'),
      province?: string(name='Province'),
    }
  ](name='SubPartnerList'),
  success?: boolean(name='Success', example='true'),
  total?: int32(name='Total', example='10'),
}

model GetSubPartnerListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSubPartnerListResponseBody(name='body'),
}

/**
 * @summary 查询二级分销商列表
 *
 * @param request GetSubPartnerListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSubPartnerListResponse
 */
async function getSubPartnerListWithOptions(request: GetSubPartnerListRequest, runtime: Util.RuntimeOptions): GetSubPartnerListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.subPartnerCompanyName)) {
    query['SubPartnerCompanyName'] = request.subPartnerCompanyName;
  }
  if (!Util.isUnset(request.subPartnerPid)) {
    query['SubPartnerPid'] = request.subPartnerPid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSubPartnerList',
    version = '2025-02-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询二级分销商列表
 *
 * @param request GetSubPartnerListRequest
 * @return GetSubPartnerListResponse
 */
async function getSubPartnerList(request: GetSubPartnerListRequest): GetSubPartnerListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSubPartnerListWithOptions(request, runtime);
}

model GetSubPartnerOrderListRequest {
  orderCreateAfter?: long(name='OrderCreateAfter', example='1727789348000'),
  orderCreateBefore?: long(name='OrderCreateBefore', example='1741008566000'),
  orderId?: long(name='OrderId', example='209335720330622'),
  orderPayAfter?: long(name='OrderPayAfter', example='1727789348000'),
  orderPayBefore?: long(name='OrderPayBefore', example='1741008566000'),
  orderStatus?: long(name='OrderStatus', example='3'),
  orderTypeList?: [ string ](name='OrderTypeList'),
  pageNo?: int32(name='PageNo', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='20'),
  payAmountAfter?: long(name='PayAmountAfter', example='1'),
  payAmountBefore?: long(name='PayAmountBefore', example='100'),
  payType?: long(name='PayType', example='1'),
  productCode?: string(name='ProductCode', example='ecs'),
  productName?: string(name='ProductName'),
  projectId?: long(name='ProjectId', example='202501101023'),
  subPartnerName?: string(name='SubPartnerName'),
  subPartnerUid?: long(name='SubPartnerUid', example='123432311'),
}

model GetSubPartnerOrderListShrinkRequest {
  orderCreateAfter?: long(name='OrderCreateAfter', example='1727789348000'),
  orderCreateBefore?: long(name='OrderCreateBefore', example='1741008566000'),
  orderId?: long(name='OrderId', example='209335720330622'),
  orderPayAfter?: long(name='OrderPayAfter', example='1727789348000'),
  orderPayBefore?: long(name='OrderPayBefore', example='1741008566000'),
  orderStatus?: long(name='OrderStatus', example='3'),
  orderTypeListShrink?: string(name='OrderTypeList'),
  pageNo?: int32(name='PageNo', description='This parameter is required.', example='1'),
  pageSize?: int32(name='PageSize', description='This parameter is required.', example='20'),
  payAmountAfter?: long(name='PayAmountAfter', example='1'),
  payAmountBefore?: long(name='PayAmountBefore', example='100'),
  payType?: long(name='PayType', example='1'),
  productCode?: string(name='ProductCode', example='ecs'),
  productName?: string(name='ProductName'),
  projectId?: long(name='ProjectId', example='202501101023'),
  subPartnerName?: string(name='SubPartnerName'),
  subPartnerUid?: long(name='SubPartnerUid', example='123432311'),
}

model GetSubPartnerOrderListResponseBody = {
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      amountDiscount?: double(name='AmountDiscount', example='0.9'),
      amountDue?: double(name='AmountDue', example='3750'),
      createdAt?: string(name='CreatedAt', example='2024-07-07 07:52:22'),
      deductedAmountByCoupons?: double(name='DeductedAmountByCoupons', example='0'),
      discountedPrice?: double(name='DiscountedPrice', example='3750'),
      orderId?: long(name='OrderId', example='236414227150922'),
      orderStatus?: int32(name='OrderStatus', example='3'),
      orderType?: string(name='OrderType', example='BUY'),
      paidAt?: string(name='PaidAt', example='2024-07-07 07:52:22'),
      payType?: int32(name='PayType', example='1'),
      price?: double(name='Price', example='3750'),
      productCode?: string(name='ProductCode', example='ecs'),
      productName?: string(name='ProductName'),
      projectId?: long(name='ProjectId', example='202502233443'),
      subPartnerName?: string(name='SubPartnerName'),
      subPartnerUid?: long(name='SubPartnerUid', example='1123132'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  pageNo?: int32(name='PageNo', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  requestId?: string(name='RequestId', description='Id of the request', example='9C14ADFE-DF0A-54D4-8BD5-45D0839246B4'),
  success?: boolean(name='Success', example='true'),
  total?: int32(name='Total', example='10'),
}

model GetSubPartnerOrderListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSubPartnerOrderListResponseBody(name='body'),
}

/**
 * @summary 查询拓渠订单
 *
 * @param tmpReq GetSubPartnerOrderListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSubPartnerOrderListResponse
 */
async function getSubPartnerOrderListWithOptions(tmpReq: GetSubPartnerOrderListRequest, runtime: Util.RuntimeOptions): GetSubPartnerOrderListResponse {
  Util.validateModel(tmpReq);
  var request = new GetSubPartnerOrderListShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.orderTypeList)) {
    request.orderTypeListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.orderTypeList, 'OrderTypeList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.orderCreateAfter)) {
    query['OrderCreateAfter'] = request.orderCreateAfter;
  }
  if (!Util.isUnset(request.orderCreateBefore)) {
    query['OrderCreateBefore'] = request.orderCreateBefore;
  }
  if (!Util.isUnset(request.orderId)) {
    query['OrderId'] = request.orderId;
  }
  if (!Util.isUnset(request.orderPayAfter)) {
    query['OrderPayAfter'] = request.orderPayAfter;
  }
  if (!Util.isUnset(request.orderPayBefore)) {
    query['OrderPayBefore'] = request.orderPayBefore;
  }
  if (!Util.isUnset(request.orderStatus)) {
    query['OrderStatus'] = request.orderStatus;
  }
  if (!Util.isUnset(request.orderTypeListShrink)) {
    query['OrderTypeList'] = request.orderTypeListShrink;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.payAmountAfter)) {
    query['PayAmountAfter'] = request.payAmountAfter;
  }
  if (!Util.isUnset(request.payAmountBefore)) {
    query['PayAmountBefore'] = request.payAmountBefore;
  }
  if (!Util.isUnset(request.payType)) {
    query['PayType'] = request.payType;
  }
  if (!Util.isUnset(request.productCode)) {
    query['ProductCode'] = request.productCode;
  }
  if (!Util.isUnset(request.productName)) {
    query['ProductName'] = request.productName;
  }
  if (!Util.isUnset(request.projectId)) {
    query['ProjectId'] = request.projectId;
  }
  if (!Util.isUnset(request.subPartnerName)) {
    query['SubPartnerName'] = request.subPartnerName;
  }
  if (!Util.isUnset(request.subPartnerUid)) {
    query['SubPartnerUid'] = request.subPartnerUid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSubPartnerOrderList',
    version = '2025-02-27',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询拓渠订单
 *
 * @param request GetSubPartnerOrderListRequest
 * @return GetSubPartnerOrderListResponse
 */
async function getSubPartnerOrderList(request: GetSubPartnerOrderListRequest): GetSubPartnerOrderListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSubPartnerOrderListWithOptions(request, runtime);
}

